import service from "@service";
import store from "@/store/global.js";
import { srDictKeyMap } from "@constants/dict";
import {
    PAY_OPTIONS,
    WHETHER_OR_NOT
} from "@constants";

async function getCodeSelect(key) {
    const res = await service("srCfgCodeSelect", {
        data: {
            codeTypeCd: key,
            provCode: store.state.provCode,
        },
        noMessageTip: true,
    })
     
     console.log(res,'data')
     const map = new Map()
     res.data.forEach((item) => {
         map.set(item.bizCode,item.codeNm)
     })
     console.log(map,'map')
     return map
     
}

/* 是否 */
export const whetherOrNot = (row) => {
    return WHETHER_OR_NOT.get(row.crossProvYn)
}
/* 支付方式 */
export const payMethodRender = (row) => {
    return PAY_OPTIONS.get(row.payMethod)
}

export const SuccessOrFailure = (flag) =>{
    let str = "";
    switch (flag) {
      case "1":
        str = "成功";
        break;
      case "0":
        str = "失败";
        break;
      default:
        str = "";
    }
    return str
}
